package com.itbaima.csmall.business.rabbit;

import com.itbaima.csmall.business.rabbit.config.RabbitMQConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * <p>RabbitConsumer</p>
 *
 * @author Chen
 * @since 2023/3/8 19:21:21
 */
@Slf4j
@RabbitListener(queues = RabbitMQConfig.BIZ_QUEUE)
@Component
public class RabbitConsumer {

    @RabbitHandler
    public void handler(@Payload String body, @Headers Map<String, Object> headers) {
        log.info("接收到消息：{}, {}", body, headers);
    }

}
